package com.yeeKa.common.response;

import com.yeeKa.enums.ResTypeEnum;
import lombok.Data;
import lombok.ToString;

@Data
@ToString
public class PageResult<T> extends Result<T> {
    private Long total;
    private String tableName;


    public PageResult<T> success(T t, Long total,String tableName) {
        this.total = total;
        this.tableName = tableName;
        super.setCode(ResTypeEnum.SUCCESS.getCode());
        super.setMsg(ResTypeEnum.SUCCESS.getDesc());
        super.setData(t);
        return this;
    }


    public PageResult<T> success(T t, Long total) {
        this.total = total;
        super.setCode(ResTypeEnum.SUCCESS.getCode());
        super.setMsg(ResTypeEnum.SUCCESS.getDesc());
        super.setData(t);
        return this;
    }

    @Override
    public PageResult<T> success() {
        super.setCode(ResTypeEnum.SUCCESS.getCode());
        super.setMsg(ResTypeEnum.SUCCESS.getDesc());
        return this;
    }

}
